//created by JIAN HUA
Ext.define("MajorProjectSenchaTouch.view.FloorPlans.floorplanListItem",{
    extend: 'Ext.dataview.component.DataItem',
    xtype : 'floorplanListItem',
    alias: 'widget.floorplanListItem',

    requires:[
    'Ext.Panel',
    'Ext.Button'
    ],
     config: {
       

        	
		imageButton:{
		pressedCls:'imageBtnClicked',
		text: '   ',
        iconAlign: 'right',
        iconCls: 'code3',
        iconMask: true
        },
		
		//--------------------------------------------------------------------------------------------------------------
        dataMap: {            
            getImageButton: {
                setText: 'locationName'
            }
            
        }
    },
    
    //apply methods----------------------------------------------------------------------------------
    
	
	applyImageButton: function(config) {
	
        return Ext.factory(config, Ext.Button, this.getImageButton());
		
    },
    updateImageButton: function(newImageButton, oldImageButton) {
		
		
        if (oldImageButton) {
            this.remove(oldImageButton);
        }

      if  (newImageButton) {
            newImageButton.on('tap', this.onImageButtonTap, this);
            this.add(newImageButton);
           
		}
    },
	
	//Listeners-----------------------------------------------------------------------------------------------

    onImageButtonTap: function(button, e){
			var record = this.getRecord();
			
			window.open(record.get("image"));
       
    }
	
	
	});